package in.zapr.druid.druidry;

import com.fasterxml.jackson.annotation.JsonInclude;
import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;

import java.util.List;
import java.util.TreeSet;

@Getter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class QuantilesPostAggregator extends DruidPostAggregator {
    private static final String QUANTILE_POST_AGGREGATOR_TYPE = "quantiles";
    private String name;
    private String fieldName;
    private TreeSet<Double> probabilities;

    @Builder
    private QuantilesPostAggregator(@NonNull final String name, @NonNull final String fieldName, @NonNull final List<Double> probabilities){
        this.type = QUANTILE_POST_AGGREGATOR_TYPE;
        this.name = name;
        this.fieldName = fieldName;
        this.probabilities = new TreeSet<>(probabilities);
    }

}
